package ANDROID_UF_MEDIAPLAYER;

public class Example {
    public boolean onKeyDown(final int keyCode, final KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
            MediaPlayer mp = new MediaPlayer();
            try {
                mp.setDataSource(PATH_TO_FILE);
                mp.prepare();
            } catch (IOException e) {
                mp.release();
            }
            mp.start();
            mp.release();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
